<template>
	<view>
		<view class="title">
			查看收款码
		</view>
		<view class="content">
			<image :src="img_pre + cover" mode=""></image>
			<view class="text">
				请用{{name}}扫码支付 <text>{{number}}</text>
			</view>
		</view>
		<view class="button">
			<button class="b1" type="default" @click="download(img_pre + cover)">保存二维码</button>
			<button class="b2" type="default" @click="bake">上传凭证</button>
		</view>
	</view>
</template>

<script>
	var than;
	export default {
		data() {
			return {
				type: 1,
				number: 0,
				cover: "",
				picture_type: 0,
				name: ""
			}
		},
		onLoad(option) {
			than = this;
			if (option.type) {
				than.type = option.type
			}
			if (option.number) {
				than.number = option.number
			}
			than.name = parseInt(option.picture_type) == 1 ? '微信' : '支付宝'
			if (option.zhujian_id) {
				than.post("api/kmb/collectionPictures", {
					zhujian_id: option.zhujian_id,
					picture_type: option.picture_type
				}, function(data) {
					if (option.img) {
						than.cover = option.img
					} else {
						than.cover = data.shoukuanma
					}
				})
			}else{
				than.cover=option.img
			}
			if (option.orderno) {
				than.post("api/Trade_buyer/collectionPictures", {
					orderno: option.orderno,
					picture_type: option.picture_type
				}, function(data) {
					if (option.img) {
						than.cover = option.img
					} else {
						than.cover = data.shoukuanma
					}
				})
			}
		},
		methods: {
			bake() {
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="less">
	.button {
		display: flex;
		align-items: center;
		padding-top: 70rpx;

		.b1 {
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			width: 245rpx;
			height: 74rpx;
			line-height: 74rpx;
			background: #FB683D;
			border-radius: 20rpx;
			box-shadow: 0px 6rpx 8rpx 0px rgba(170, 170, 170, 0.16);
		}

		.b2 {
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #333333;
			width: 245rpx;
			height: 74rpx;
			background: #F1F1F1;
			border-radius: 20rpx;
			line-height: 74rpx;
			background: #F4F4F7;
			box-shadow: 0px 6rpx 8rpx 0px rgba(170, 170, 170, 0.16);
		}
	}

	.content {
		margin: 0 36rpx;
		height: 877rpx;
		background: linear-gradient(180deg, #EEF7FE, #FBFCFE);
		border-radius: 20rpx;
		text-align: center;

		image {
			margin: 43rpx auto 48rpx;
			width: 489rpx;
			height: 655rpx;
		}

		.text {

			font-size: 36rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #333333;

			text {
				margin-left: 15rpx;
				font-size: 48rpx;
				font-family: DINCond-Black;
				font-weight: bold;
				color: #FEC31D;
			}
		}
	}

	.title {
		font-size: 36rpx;
		height: 100rpx;
		line-height: 100rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #333333;
		padding: 0 34rpx;
	}
</style>
